package com.student.demo.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
//学生基本信息类
@Entity
public class Student {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer aId;
	private String aNumber;
	private String aName;
	private Integer aex;
	private Date aBirth;
	private String aMajor;
	
	private String aPhone;
	private Date aDate;
	private String aHome;
	
	@ManyToOne(cascade=CascadeType.DETACH)     //PERSIST添加数据级联 不需考虑先后顺序
	@JoinColumn(name="cId")     //不能为空  设置外键
	private ClassInformation classInformation;

	
	@OneToOne(mappedBy="student")
	@NotFound(action=NotFoundAction.IGNORE)
	private ChengJi chengJi;
	
	
	
	
	public ClassInformation getClassInformation() {
		return classInformation;
	}
	public void setClassInformation(ClassInformation classInformation) {
		this.classInformation = classInformation;
	}
	public ChengJi getChengJi() {
		return chengJi;
	}
	public void setChengJi(ChengJi chengJi) {
		this.chengJi = chengJi;
	}
	public Integer getaId() {
		return aId;
	}
	public void setaId(Integer aId) {
		this.aId = aId;
	}
	public String getaNumber() {
		return aNumber;
	}
	public void setaNumber(String aNumber) {
		this.aNumber = aNumber;
	}
	public String getaName() {
		return aName;
	}
	public void setaName(String aName) {
		this.aName = aName;
	}
	public Integer getAex() {
		return aex;
	}
	public void setAex(Integer aex) {
		this.aex = aex;
	}
	public Date getaBirth() {
		return aBirth;
	}
	public void setaBirth(Date aBirth) {
		this.aBirth = aBirth;
	}
	public String getaMajor() {
		return aMajor;
	}
	public void setaMajor(String aMajor) {
		this.aMajor = aMajor;
	}
	public String getaPhone() {
		return aPhone;
	}
	public void setaPhone(String aPhone) {
		this.aPhone = aPhone;
	}
	public Date getaDate() {
		return aDate;
	}
	public void setaDate(Date aDate) {
		this.aDate = aDate;
	}
	public String getaHome() {
		return aHome;
	}
	public void setaHome(String aHome) {
		this.aHome = aHome;
	}
	
}
